<!DOCTYPE html>
<html>
<head>
<title>用户管理</title>
<link href="../../../common/all.css" rel="stylesheet">
<script type="text/javascript" src="../../../common/all.js"></script>

<style type="text/css">

.form-actions{
     padding-right: 1000px;
}
#messageBox{
 color: red;
}
</style>


<script type="text/javascript">

	$(document).ready(function() {
		
	      initparameter();
		
		$("#inputForm").validate({
			submitHandler: function(form){
				//loading('正在提交，请稍等...');
				update();
			},
			errorContainer: "#messageBox",
			errorPlacement: function(error, element) {
				$("#messageBox").text("输入有误，请先更正。");
				if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
					error.appendTo(element.parent().parent());
				} else {
					error.insertAfter(element);
				}
			}
		});
	});
	
	
	function initparameter(){
		var id=getUrlParam("id");
		if(id==null||id==""){
			alert("参数异常，无法修改！");
			return;
		}
		$("#_parameterId").val(id);
		
		$.ajax({
			url : getContextPath()+"/sys/parameter/get",
			type : "GET",
			dataType : "json",
			data :{"id":id},
			success : function(returnData,status,XMLHttpRequest)
			{	
				
			   // resolveResultBeanIsOk(returnData,status);
			    if(handleAjaxRequest(returnData,status,XMLHttpRequest))
			    {
			    	var data=returnData.data;
// 			    	$("#_type").val(data.type);
			    	$("#_keyx").val(data.keyx);
			    	$("#_value").val(data.value);
			    	
			    	$("#_sort").val(data.sort);

			    	$("#_remake").text(data.remake);
			    	
			    	 //状态redio
					  var status=data.status;
					  if(status==0){
						  $("input[name=status]:eq(0)").attr("checked",'checked'); 
					  }else if(status==1)
					  {
						  $("input[name=status]:eq(1)").attr("checked",'checked'); 

					  }

			    	
			    }
			},
			error:function() {
				alert("请求异常！");
			}
		});
		
	}

	
	//
	function update(){
		
		var jobj=$("#inputForm").serialize();
		$.ajax({
			url : getContextPath()+"/sys/parameter/update",
			type : "POST",
			dataType : "json",
			data :jobj,
			success : function(returnData,status,XMLHttpRequest)
			{	
			    resolveResultBeanIsOk(returnData,status);
			},
			error:function() {
				alert("请求异常！");
			}
		});
		
	}
			

</script>

</head>

<body style="overflow-x: hidden; overflow-y: hidden;">

	
 <div class="parameterClz">
             
      <form id="inputForm" action="" class="form-horizontal" role="form">
      
       <input id="_parameterId" name="id" type="hidden">

            <div class="form-group">
               <label class="col-sm-2 control-label" > <span class="help-inline"><font color="red">*</font> </span>健：   
               </label>
               <div class="col-sd-1">
                  <input class="required input-xlarge" maxlength="20" name="keyx"  id="_keyx" type="text" />
               </div>
         
            </div>
            
            
               <div class="form-group">
               <label class="col-sm-2 control-label "> <span class="help-inline"><font color="red">*</font>值：</label>
               <div class="col-sd-1">
                  <input class="required" maxlength="20" type="text"  name="value" id="_value"/>
               </div>
            </div>
            
        
            
            
              <div class="form-group">
               <label class="col-sm-2 control-label " >
               <span class="help-inline"><font color="red">*</font>状态：</label>
               <div class="col-sd-1">
			      &nbsp;  &nbsp;&nbsp;启用 <input type="radio" name="status" value="0" checked="checked"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;禁用<input type="radio" name="status" value="1"/>
               </div>
            </div>
            
         
                    
                 <div class="form-group">
               <label class="col-sm-2 control-label "> <span class="help-inline">排序：</label>
               <div class="col-sd-1">
                  <input class="required" maxlength="20" type="text"  name="sort" id="_sort"/>
               </div>
            </div>
        
            
            <div class="form-group">
               <label class="col-sm-2 control-label " >
                                            备注：</label>
               <div class="col-sm-2">
               <textarea rows="6" cols="60"  maxlength="200" name="remake" id="_remake"></textarea>
               </div>
            </div>
            
         
            <div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		    </div>    
         </form>
         
    </div>

</body>
</html>